package com.example.mybatis1.mapper;

import com.example.mybatis1.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: UserInfoMapper
 * Package: IntelliJ IDEA
 * Description:
 *
 * @Author 谷京京
 * @Create 2023/11/13 15:49
 * @Version 1.0
 */
@Mapper
public interface UserInfoMapper {
    @Select("select * from userinfo")
    List<UserInfo> selectAll();
    @Select("select * from userinfo where id = #{id}")
    UserInfo selectOne(Integer id);
    @Select("select * from userInfo order by ${method} ${sort}")
    List<UserInfo> selectUserBySort(String sort, String method);
    @Select("select * from userinfo where username like '%${username}%'")
    List<UserInfo> selectNyLike(String username);

    @Select("select * from userinfo where username like concat('%', #{username}, '%')")
    List<UserInfo> selectNyLike2(String username);
}
